<?php

$form = $this->beginWidget ( 'bootstrap.widgets.TbActiveForm', array (
		'id' => 'player-form',
		'enableAjaxValidation' => false,
		'htmlOptions' => array (
				'enctype' => 'multipart/form-data'
		)
) );

$teams = Team::model()->findAllByAttributes(array('status' => 'ATIVO'));
$values = array();
if($teams != null && count($teams > 0)) {
	foreach($teams as $team) {
		$values[$team->id] = $team->name; 
	}
}
?>

<p class="help-block">
	Campos com <span class="required">*</span> são obrigatórios.
</p>

<?php echo $form->errorSummary($model); ?>

<span class="span7">
			<?php echo "<br/><h5>Foto *</h5>"; ?>
	</span>
<?php echo $this->renderPartial('/file/_form', array('form'=>$form, 'formats'=>'jpg|jpeg|png|gif',  'images'=>$foto, 'filename'=>'foto', 'size'=> 1));?>

<span class="span9">
	<?php echo $form->textFieldRow($model,'federation_id',array('class'=>'span7','maxlength'=>20)); ?>
	</span>

<?php if($_SESSION['user']->username == 'admin') { ?>
	<span class="span9">
	<?php echo $form->dropDownListRow(
    	$model, 'category_id',$values,
   	 		array('class'=>'span4','maxlength'=>50));?>
	</span>
<?php } ?>

<span class="span9">
	<?php echo $form->textFieldRow($model,'name',array('class'=>'span7','maxlength'=>250)); ?>
	</span>
<span class="span9">
	<?php echo $form->textFieldRow($model,'nickname',array('class'=>'span7','maxlength'=>250)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'natural_country',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'natural_state',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span2">
	<?php echo $form->textFieldRow($model,'natural_city',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span3">
		 	<?php echo $form->labelEx($model, 'birthy_date'); ?>
			<?php
			
$this->widget ( 'zii.widgets.jui.CJuiDatePicker', array (
					'model' => $model,
					'attribute' => 'birthy_date',
					'name' => 'birthy_date',
					'language' => 'pt',
					'options' => array (
							'type' => 'date',
							'dateFormat' => 'dd-mm-yy',
							'style' => 'width:100px',
							'showAnim' => 'slide', // 'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop'
							'changeMonth' => true,
							'changeYear' => true,
							'minDate' => '01-01-1900',
							'maxDate' => "-1D" 
					),
					'htmlOptions' => array (
							'value' => CTimestamp::formatDate ( 'd-m-Y' ) 
					) 
			) );
			?> 
			<?php echo $form->error($model, 'birthy_date'); ?>
		</span>
</span>
<span class="span3">
	<?php echo $form->dropDownListRow($model,'gender',array('MASCULINO','FEMININO'),array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span2">
	<?php echo $form->textFieldRow($model,'ctps',array('class'=>'span3','maxlength'=>20)); ?>
	</span>
<span class="span7">
	<?php echo $form->textFieldRow($model,'father_name',array('class'=>'span7','maxlength'=>250)); ?>
	</span>
<span class="span7">
	<?php echo $form->textFieldRow($model,'mother_name',array('class'=>'span7','maxlength'=>250)); ?>
	</span>
<span class="span7">
	<?php echo $form->textFieldRow($model,'email',array('class'=>'span7','maxlength'=>250)); ?>
	</span>
<span class="span7">
	<?php echo $form->textFieldRow($model,'address',array('class'=>'span7','maxlength'=>250)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'neightborhood',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'state',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span2">
	<?php echo $form->textFieldRow($model,'city',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'cert_birthy',array('class'=>'span3')); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'rg',array('class'=>'span3','maxlength'=>20)); ?>
	</span>
<span class="span2">
	<?php echo $form->textFieldRow($model,'emissor',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'doc_validate',array('class'=>'span3')); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'cpf',array('class'=>'span3','maxlength'=>13)); ?>
	</span>
<span class="span2">
	<?php echo $form->textFieldRow($model,'cnh',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<?php if($model->id == null || $model->id == 0) {?>
<span class="span7">
			<?php echo "<br/><h5>Anexar Arquivos *</h5>"; ?>
		</span>
<!-- Anexa Arquivos -->
<?php echo $this->renderPartial('/file/_form', array('form'=>$form, 'formats'=>$formats, 'images'=>$images, 'filename'=>'filenames', 'size'=> 5));?>
	<?php }?>

<span class="span7">
	<div class="form-actions" align="center">
		<?php
		
$this->widget ( 'bootstrap.widgets.TbButton', array (
				'buttonType' => 'submit',
				'type' => 'primary',
				'label' => $model->isNewRecord ? 'Cadastrar' : 'Salvar' 
		) );
		?>
	</div>
</span>

<?php $this->endWidget(); ?>
